Repository navigation
Add graph-safe ops and Inductor heuristics - #106
Merged
Merged
Conversation
froststeam
force-pushed
the
musa-graph-safe-ops
branch
2 times, most recently
from
August 23, 2026 07:40
a2b22d8 to
39f0101
Compare
froststeam
force-pushed
the
musa-graph-safe-ops
branch
from
August 24, 2026 01:48
39f0101 to
dde6c15
Compare
froststeam
force-pushed
the
musa-graph-safe-ops
branch
3 times, most recently
from
August 24, 2026 04:40
e58ce73 to
2751120
Compare
froststeam
force-pushed
the
musa-graph-safe-ops
branch
from
August 24, 2026 04:53
2751120 to
a34ab87
Compare
yeahdongcn
reviewed
Aug 24, 2026
yeahdongcn
reviewed
Aug 25, 2026
yeahdongcn
reviewed
Aug 25, 2026
froststeam
force-pushed
the
musa-graph-safe-ops
branch
4 times, most recently
from
August 27, 2026 12:00
a5fd652 to
86b7a04
Compare
froststeam
force-pushed
the
musa-graph-safe-ops
branch
from
August 27, 2026 12:06
86b7a04 to
fbcff52
Compare
# Conflicts: # benchmarks/benchmark_history.json
yeahdongcn
approved these changes
Aug 28, 2026
yeahdongcn
added a commit
that referenced
this pull request
Oct 10, 2026
The English and Chinese READMEs have not kept up with the May-October work. This documents what merged, moves the version-gated shims into one table, and refreshes the measured numbers that had gone stale. Feature table - CUDA memory-pool APIs, `torch.cuda.streams`, CUDA-graph executable rotation, `torch.cuda._get_device_index`, `get_memory_info()`, and the FlashAttention provider shims (#61, #98, #103, #106, #108, #115) - the "What Works" table goes back to one line per feature; the paragraph-sized `log_` / `isfinite` / `out_dtype` cells move into the new section below New "torch_musa Compatibility" section - one table of every version-gated shim with the release it is installed on: the four `< 2.11.0.post2` patches (#106, #113, #124), the `< 2.13.0` `mm`/`bmm` `out_dtype=` backport (#116), the stable-ABI header backport (#86, #96), asynchronous `isfinite` (#120), and `torch.cuda.streams` (#98) New "Environment Variables" section - the graph-rotation knobs (#72), `TORCHADA_PLATFORM`, the C++ operator-override switches (#61, #128), and the two variables that were already documented Corrected and extended details - torch.compile: FX `device` builtin (#124), Dynamo's device-index helper (#108), `MUSA_VISIBLE_DEVICES` mirroring (#106) - C++ extensions: nested `<torch/cuda.h>` porting (#95), stable-ABI `STABLE_TORCH_LIBRARY_IMPL` rekeying and stream helpers (#100), torch 2.6+ `include_paths`/`library_paths` signatures (#121), stale JIT build locks (#128) - MoE tables are generated from checked-in recipes (#115) - unsupported CUDA runtime APIs as no-ops (#65) - Performance: replace the 0.1.94 / torch_musa 2.7.1 numbers with the checked-in 0.1.95 / 2.11.0.post2 entry, and stop claiming every fast path is under 200ns
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add the graph-safe MUSA compatibility required by CUDA-facing inference paths and bump torchada from
0.1.83to0.1.85:PrivateUse1overrides foraten::multinomial,aten::log, andaten::log_on affected torch_musa releasesMUSA_VISIBLE_DEVICEStoCUDA_VISIBLE_DEVICESwhen both are presenttorch_musa version boundary
The TorchAda graph-safe compatibility is temporary and is limited to torch_musa versions before
2.11.0.post2:The existing
_TORCH_MUSA_ACCELERATOR_FIX_VERSION = "2.11.0.post2"is reused for this decision. The version is read from the existingtorch.musa.__version__surface; no extra package-version helper or unconditionalimport torch_musais added just for version detection.On
torch_musa >= 2.11.0.post2:load_cpp_ops()returns before building/loading TorchAda's C++ override extensiontorch_musa/ATen ownslog,log_, andmultinomialdispatch directlymusa_ops.muThe currently published vLLM-MUSA image is still based on
torch_musa 2.11.0.post1+musa5.2.0, so it remains on the compatibility side of this boundary.Scope
This PR does not change global CUDA platform semantics:
torch.cuda.is_available()torch.cuda.get_device_capability()torch.loadmap locationsTesting
Focused validation was run with the PR source overlaid in the MUSA-enabled vLLM-MUSA image:
PYTHONPATH=src python -m pytest -q tests/test_cuda_patching.py \ -k "VisibleDevicesEnv or InductorTemplateHeuristics or TestAcceleratorModuleWrapper or test_cpp_ops_loaded_on_musa"Operator correctness and graph replay tests on the same post1 MUSA runtime:
The version-boundary tests cover the existing post2 accelerator gate, post2 native Inductor registration behavior, local-version suffixes such as
+musa5.2.0, and the post2+ no-C++-override behavior.git diff --checkand Python syntax compilation also pass.Downstream image validation
registry.mthreads.com/mcconline/inference/sglang:v0.5.12.post1-ph1-4.3.5-torch2.9.0-202608192.9.0/40305registry.mthreads.com/mcconline/inference/vllm:v0.24.0-ph1-5.2.0-torch2.11.0.post1-202608272.11.0.post1+musa5.2.0/50200A direct runtime probe in the latest image confirmed:
Request-level vLLM compile smoke
A request-level Qwen3-0.6B vLLM compile and GSM8K follow-up was run on MUSA with
CompilationMode.VLLM_COMPILE(mode=3) using the compatible imageregistry.mthreads.com/mcconline/inference/vllm:v0.24.0-ph1-5.2.0-torch2.9.1.post1-20260805.The service completed compilation, graph capture, a direct completion request, and the official 200-question GSM8K evaluator:
The server log contained no runtime exception, backend compiler failure, graph break, or eager fallback during evaluation.
Limitations
torch_musa 2.11.0.post2wheel/tag is available yet; post2 behavior is covered by version-boundary tests and the code path is fail-safe for unknown versions.20260819and20260824Qwen3 startup attempts hit a pre-existing vLLM-MUSAis_neoxsignature mismatch, so request-level evaluation used the compatible20260805image.